package org.higginsexamples.multiusermail.rcpmail;

import org.eclipse.higgins.rp.icard.token.identity.DigitalIdentity;

class RcpMailModel extends Mailbox {

	public RcpMailModel() {
		super("");
	}

	/**
	 * Perform the user login with the parameters obtained from the LoginDialog
	 * 
	 * @param email
	 * @param password
	 * @param iCard
	 * @return true if the login is successful
	 */
	public static RcpMailModel login(String email, String password,
			DigitalIdentity iCard) {

		// TODO perform the login
		System.out.println("TODO performing login for email='" + email
				+ "' with password='" + password + "' with iCard " + iCard);

		MailboxClient client = new MailboxClient(email, password, iCard);
		try {
			RcpMailModel model = client.load();
			return model;
		} catch (Exception e) {
			// TODO Auto-generated catch block
			e.printStackTrace();
		}
		return null;
	}
}